/**
 * 
 */
package client;

import java.net.Socket;

/**
 * @author Sunny
 *
 */
public class Player extends Thread{
	
	private String idNo = null;
	private String ip = null;
	private int port = 0;
	private Socket soc = null;
	
	private int treaCollected = 0;
	private int xPos = -1;
	private int yPos = -1;
	
	private Maze game = null;
	private String dir = "";
	
	/**
	 * Constructor
	 */
	public Player(String ip, int port, String id, Socket socket)
	{
		this.ip = ip;
		this.port = port;
		this.idNo = id;
		this.soc = socket;
	}
	
	/**
	 * Set methods
	 */
/*	
	public void setIdNo(int val)
	{
		idNo = val;
	}
*/	
	public void setTreaCollected(int val)
	{
		treaCollected = val;
	}
/*	
	public void setGame(Maze _game)
	{
		game = _game;
	}
	public void setDir(String _dir)
	{
		dir = _dir;
	}
*/	
	public void addTreaCollected(int val)
	{
		treaCollected += val;
	}
	
	public void setPosition(int x, int y)
	{
		xPos = x;
		yPos = y;
	}
	
	public void setXPos(int x)
	{
		xPos = x;
	}
	
	public void setYPos(int y)
	{
		yPos = y;
	}
	
	/**
	 * Get methods
	 */
	
	public String getIdNo()
	{
		return idNo;
	}
	
	public int getTreaCollected()
	{
		return treaCollected;
	}
	
	public int getXPos()
	{
		return xPos;
	}
	
	public int getYPos()
	{
		return yPos;
	}
	public String getIp()
	{
		return ip;
	}
	
	public int getPort()
	{
		return port;
	}
	
	public Socket getSocket()
	{
		return soc;
	}
/*	
	public synchronized void run(){
		if (this != null && dir != null)
		{
			boolean b = game.movePlayer(dir, 1, this);

			if (b)
			{
				try {
					ServerConnection.send("200_"+this.getIdNo()+"_"+this.getXPos()+"_"+this.getYPos()+"_"+this.getTreaCollected()+"_"+game.getTreaAvailable()+"_Others<>.");
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			else
			{
				try {
					ServerConnection.send("Cannot move!");
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			
		}
		else
		{			
			try {
				ServerConnection.send("Cannot move!");
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			//Connection.closeConnection();
		}
	}
*/

	/**
	 * @param args
	 */
	/*public static void main(String[] args) {
		// TODO Auto-generated method stub

	}*/

}
